package com.codedancer.campus.client.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.codedancer.campus.client.service.IFeedbackRecordTypeService;
import com.codedancer.campus.client.service.vo.feedbackRecordType.FeedbackRecordTypeVo;
import com.codedancer.campus.mapper.FeedbackRecordTypeMapper;
import com.codedancer.campus.po.FeedbackRecordType;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class FeedbackRecordTypeServiceImpl implements IFeedbackRecordTypeService {

    @Autowired
    private FeedbackRecordTypeMapper feedbackRecordTypeMapper;

    /*8
    获取全部反馈记录类型
     */
    @Override
    public List<FeedbackRecordTypeVo> all() {
        List<FeedbackRecordType> feedbackRecordTypes = feedbackRecordTypeMapper.selectList(null);
        return feedbackRecordTypes.stream().map(
            feedbackRecordType -> BeanUtil.copyProperties(feedbackRecordType,
                FeedbackRecordTypeVo.class)).collect(
            Collectors.toList());
    }
}
